import { requestClient } from './request';

// 上传图像的 API
export const uploadImage = async (files: File[], modelName: string) => {
    const formData = new FormData();
    files.forEach(file => formData.append('images', file));
    formData.append('model_name', modelName);
    console.log('上传图像:', formData);
    try {
        const response = await requestClient.post('/process_image', formData, {
            headers: {
                'Content-Type': 'multipart/form-data', // 设置请求头
            },
        });

        console.log('上传图像成功:', response);
        return response; // 返回数据
    } catch (error) {
        console.error('上传图像失败:', error);
        throw error;
    }
};
